You are here: Statements and Functions > ResQty()
Syntax samples
RESQTY({<resource name>})
IF RESQTY(Res1) > 5 THEN FREE 5 Res1
Returns the number of units of the specified resource that the current entity owns. RESQTY() can be used to determine the amount of time necessary to process an entity based on the number of resources an entity owns.
Entity speed fields, traveling-time fields, resource fields, location processing logic, routing fields, arrival logic, debug user-condition fields, and exit logic. This function returns an integer.
Components
<resource name>
The name of the resource to check for. If no resource name is specified, the total number of units of all resource types owned by the entity is returned. RES() may be substituted for a resource name.
Example
The example below demonstrates the use of RESQTY() to adjust the processing time for an entity based on the number of resources available to process it. Before EntA’s arrive at Loc1, they capture a certain number of resources named Res1. Processing logic at Loc1 determines how many Res1’s each EntA captured and processes it accordingly. The more resources an entity captures, the more workers available to work on the project, and the less time it takes. ProModel then routes EntA’s on to Loc2. The logic at Loc2 makes sure that no EntA owns more than one Res1.
Process Table
Entitiy |
Location |
Operation (min) |
---|---|---|
EntA |
Loc1 |
WAIT 120/RESQTY(Res1) |
EntA |
Loc2 |
IF RESQTY(Res1)>1 THEN FREE (RESQTY(Res1)-1) Res1 |
Routing Table
Blk |
Output |
Destination |
Rule |
Move Logic |
---|---|---|---|---|
1 |
EntA |
Loc2 |
FIRST 1 |
|
1 |
EntA |
Loc3 |
FIRST 1 |
|
FREECAP(), FREEUNITS(), and GROUPQTY().